package com.edfu.core.testmgt.vo;

import java.io.Serializable;
import java.util.Set;

import javax.xml.bind.annotation.XmlRootElement;

import com.edfu.core.commons.beans.Category;
import com.edfu.core.commons.beans.Discount;
import com.edfu.core.commons.beans.Sell;

@XmlRootElement (name = "Test")
public class Test implements Serializable {
	
	private static final long serialVersionUID = -9049096518606766855L;
	
	private long id;
	private Set<Question> questions;
	private String code;
	private String name;
	private String logo;
	private String desc;
	private double totalMarks;
	private double positiveMarks;
	private double negativeMarks;
	private String createdBy;
	private long createdDate;
	private boolean active;
	private double passMarks;
	private long duration;
	private TestType  testType;
	private Set<Category> categories;
	private TestBundle testBundle;
	private boolean allowReattempt;
	private boolean allowReview;
	private boolean allowChangeAnswers;
	private boolean timeBased;
	private String instructions;
	private Sell sell;
	private Discount discount;
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}	
	
	public Set<Question> getQuestions() {
		return questions;
	}
	public void setQuestions(Set<Question> questions) {
		this.questions = questions;
	}
	
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String getLogo() {
		return logo;
	}
	public void setLogo(String logo) {
		this.logo = logo;
	}
	
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	public double getTotalMarks() {
		return totalMarks;
	}
	public void setTotalMarks(double totalMarks) {
		this.totalMarks = totalMarks;
	}
	
	public double getPositiveMarks() {
		return positiveMarks;
	}
	public void setPositiveMarks(double positiveMarks) {
		this.positiveMarks = positiveMarks;
	}
	
	public double getNegativeMarks() {
		return negativeMarks;
	}
	public void setNegativeMarks(double negativeMarks) {
		this.negativeMarks = negativeMarks;
	}
	
	public String getCreatedBy() {
		return createdBy;
	}
	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}
	
	public long getCreatedDate() {
		return createdDate;
	}
	public void setCreatedDate(long createdDate) {
		this.createdDate = createdDate;
	}
	
	public boolean isActive() {
		return active;
	}
	public void setActive(boolean active) {
		this.active = active;
	}
	
	public double getPassMarks() {
		return passMarks;
	}
	public void setPassMarks(double passMarks) {
		this.passMarks = passMarks;
	}
	
	public TestType getTestType() {
		return testType;
	}
	public void setTestType(TestType testType) {
		this.testType = testType;
	}
	
	public TestBundle getTestBundle() {
		return testBundle;
	}
	public void setTestBundle(TestBundle testBundle) {
		this.testBundle = testBundle;
	}	
	
	public long getDuration() {
		return duration;
	}
	public void setDuration(long duration) {
		this.duration = duration;
	}
	
	public boolean isAllowReattempt() {
		return allowReattempt;
	}
	public void setAllowReattempt(boolean allowReattempt) {
		this.allowReattempt = allowReattempt;
	}
	
	public boolean isAllowReview() {
		return allowReview;
	}
	public void setAllowReview(boolean allowReview) {
		this.allowReview = allowReview;
	}
	
	public boolean isAllowChangeAnswers() {
		return allowChangeAnswers;
	}
	public void setAllowChangeAnswers(boolean allowChangeAnswers) {
		this.allowChangeAnswers = allowChangeAnswers;
	}
	
	public boolean isTimeBased() {
		return timeBased;
	}
	public void setTimeBased(boolean timeBased) {
		this.timeBased = timeBased;
	}
	
	public String getInstructions() {
		return instructions;
	}
	public void setInstructions(String instructions) {
		this.instructions = instructions;
	}
	
	public Set<Category> getCategories() {
		return categories;
	}
	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}
	
	public Sell getSell() {
		return sell;
	}
	public void setSell(Sell sell) {
		this.sell = sell;
	}
	
	public Discount getDiscount() {
		return discount;
	}
	public void setDiscount(Discount discount) {
		this.discount = discount;
	}
	
	@Override
	public String toString() {
		return "Test [code=" + code + ", name=" + name + ", active=" + active
				+ "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Test other = (Test) obj;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}	

}
